package com.zl.personal.api.dao.impls;

import com.zl.personal.api.dao.inters.ITestDao;
import com.zl.personal.api.domains.entity.Test;
import org.crazycake.jdbcTemplateTool.JdbcTemplateTool;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * Created by zhonglin on 2017/4/7.
 */
@Repository
public class TestDao implements ITestDao {

//    @Autowired
//    private JdbcTemplate jdbcTemplate;
//
    @Autowired
    private JdbcTemplateTool jdbcTemplateTool;


    @Override
    public List<Test> findAll() {
        String sql = "SELECT * FROM TEST";
        List<Test> list = jdbcTemplateTool.list(sql, null, Test.class);

        //int i = jdbcTemplateTool.count("select count(1) from TEST", null);

        return list;
    }
}
